package com.ruoyi.web.controller.ui;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.domain.QtUser;
import com.ruoyi.system.mapper.QtUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/exam/user")
public class UserController extends BaseController {
    @Autowired
    QtUserMapper qtUserMapper;

    @PostMapping("/login")
    public AjaxResult login(@RequestBody QtUser qtUser){
        List<QtUser> user=qtUserMapper.selectQtUserList(qtUser);
        return AjaxResult.success(user.get(0));
    }

    @PostMapping("/zhuce")
    public AjaxResult zhuce(@RequestBody QtUser qtUser){
        qtUser.setUserId(IdUtils.randomUUID());
        return toAjax(qtUserMapper.insertQtUser(qtUser));
    }

}
